"""Helper functions

Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to both as 'h'.
"""
from webhelpers import *

from creoleparser.dialects import Creole10
from creoleparser.core import Parser
from pylons import config, request

my_dialect=Creole10(
    wiki_links_base_url='/pages/',
    interwiki_links_base_urls={'wikicreole':'http://wikicreole.org/wiki/'},
)

wiki2html = Parser(dialect=my_dialect)

def wiki2html(*args):
    raise "deprecated"

def formatdatetime(dt):
    return dt.strftime(config['mtp.config']['wiki']['datetime_format'])

def absolute_url(url):
    return "http://%s%s" % (request.environ['HTTP_HOST'], url)

def absolute_url_for(*args, **kwargs):
    return absolute_url(url_for(*args, **kwargs))



